import { memo, useEffect } from "react";
import { useLocation } from "react-router-dom";
// 用来保证每次页面跳转都在顶部
export const ScrollToTop = memo(() => {
  const location = useLocation();
  useEffect(() => {
    window.scrollTo({
      top: 0,
      left: 0,
      behavior: 'smooth'
    });
  }, [location.key]);
  return null;
});
